import instance from '../utils/request'
// import axios from 'axios'

//获取所有鸟类信息(鸟类列表)
export const getBirdsListService = () => {

    return instance.post('/birds/getAllBirds',null)

}

//更新鸟类信息
export const updateBirdInfoService = (birdInfo) => {

    //借助于UrlSearchParams进行传递参数
    const param = new URLSearchParams();
    for(let key in birdInfo){
        param.append(key,birdInfo[key])
    }

    return instance.post('/birds/updateBirds',param)

}

//删除鸟类信息
export const deleteBirdInfoService = (birdId) => {

    const param = new URLSearchParams();
    param.append('id',birdId)

    return instance.post('/birds/deleteBirds',param)

}

//添加鸟类信息
export const addBirdInfoService = (birdInfo) => {

    //借助于UrlSearchParams进行传递参数
    const param = new URLSearchParams();
    for(let key in birdInfo){
        param.append(key,birdInfo[key])
    }

    return instance.post('/birds/addBirds',param)

}

//根据id获取鸟类信息
export const getBirdInfoByIdService = (birdId) => {

    const param = new URLSearchParams();
    param.append('id',birdId)

    return instance.post('/birds/getBirdsById',param)

}

//根据名称获取鸟类信息
export const getBirdInfoByNameService = (birdName) => {

    const param = new URLSearchParams();
    param.append('name',birdName)

    return instance.post('/birds/getBirdsByName',param)

}



